package com.cyl.XmlDemo.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessageSendingOperations;
import org.springframework.stereotype.Service;

import com.cyl.XmlDemo.entity.Shout;

@Service
public class MarcoService {
	
	private Logger logger = LoggerFactory.getLogger(MarcoService.class);
	
	@Autowired
	private SimpMessageSendingOperations messaging;

	public void sendMsg(Shout shout){
		logger.debug("Marco Service 服务被调用");
		/* 注意：不能把消息传给应用程序 否则无效，应该传递给 消息代理 */
		messaging.convertAndSend("/topic/marco-server",shout);
		logger.debug("Marco Service 完成任务");
	}
}
